$(function() {
    var dom = document.getElementById("operatingRateTWo");
    var myChart = echarts.init(dom);
    var app = {};
    // option
    option = {
        xAxis: {
            type: 'category',
            data: ['一月', '二月', '三月', '四月', '五月', '六月'],
            axisLabel: {
                textStyle: {
                    // color: 'white',
                    color: 'black'
                }
            },
            axisLine: {
                lineStyle: {
                    // color: 'white',
                    color: 'black',
                    width: 3
                }
            }
        },
        grid: {
            top: '5%',
            left: '15%',
            right: '10%',
            bottom: '10%'
        },
        legend: {
            data: ['模具故障率', '设备故障率', '综合开动率', '目标值'],
            bottom: '0',
            textStyle: {
                // color: 'white',
                color: 'black'
            }
        },
        tooltip: {
            trigger: 'axis'
        },
        yAxis: [
            {
                type: 'value',

                axisLabel: {
                    formatter: '{value} %',
                    textStyle: {
                        // color: 'white',
                        color: 'black'
                    }
                },
                axisLine: {
                    show: true,
                    lineStyle: {
                        // color: 'white',
                        color: 'black',
                        width: 3
                    }
                }
            }
        ],
        series: [
            {
                name: '模具故障率',
                data: [15.0, 16.3, 15.3, 17.3, 10.6, 17.2],
                type: 'bar',
                stack: 'two',
                showBackground: true,
                itemStyle: {
                    normal: {
                        color: '#c55a11'
                    }
                },
                barWidth: '40%',
                label: {
                    show: true,
                    position: 'top',
                    formatter: '{c}%'
                },
                backgroundStyle: {
                    color: 'transparent'
                },
                markLine : {
                    data : [
                        {type : 'average', name: '平均值'}
                    ]
                }
            }
        ]
    };
    if (option && typeof option === "object") {
        myChart.setOption(option, true);
    }
})
